<?php
// +----------------------------------------------------------------------
// | 跃飞 [ 将来的你一定会感激现在奋斗的自己 ]
// +----------------------------------------------------------------------
// | Author: 钟贵廷
// +----------------------------------------------------------------------
// | URI1: https://gitee.com/yeafy   URI2:https://github.com/gtzhong
// +----------------------------------------------------------------------
// | weChat:gt845272922  qq:845272922
// +----------------------------------------------------------------------

namespace app\yeafy\observer\demo1;


class Teacher implements IObserver
{
    private $subject;
    public function update($data)
    {
        switch ($data)
        {
            case "写作业":
                echo "老师继续观察<br/>";
                break;
            case "读书":
                echo "老师继续观察<br/>";
                break;
            case "聊天":
                echo "老师批评<br/>";
                break;
            case "玩手机":
                echo "老师没收手机<br/>";
                break;
        }
    }

    public function observerStudent(Student $subject)
    {
        $this->subject = $subject;
        $this->subject->registerObserver($this);
    }


}